package com.scwatch.core.domain;

import com.scwatch.core.support.Configurable;

import java.util.HashMap;
import java.util.Map;

public class SiteJpush implements Configurable {
    public static final String PREFIX = "";


    public static final String STATUS = "status";
    public static final String DEVICE_ID = "deviceId";
    public static final String APIKEY = "androidApiKey";
    public static final String SECREKEY = "androidSecretKey";
    public static final String IOSAPIKEY = "iosApiKey";
    public static final String IOSSECRETKEY = "iosSecretKey";
    public static final String ISJPUSH = "isJpush";


    public String getIsJpush(){return getCustoms().get(ISJPUSH);}
    public void  setIsJpush(String model){
        if (model != null) {
            getCustoms().put(ISJPUSH, model.toString());
        } else {
            getCustoms().remove(ISJPUSH);
        }
    }


    public String getAndroidApiKey() {
        return getCustoms().get(APIKEY);
    }

    public void setAndroidApiKey(String model) {
        if (model != null) {
            getCustoms().put(APIKEY, model.toString());
        } else {
            getCustoms().remove(APIKEY);
        }
    }

    public String getAndroidSecretKey() {
        return getCustoms().get(SECREKEY);
    }

    public void setAndroidSecretKey(String model) {
        if (model != null) {
            getCustoms().put(SECREKEY, model.toString());
        } else {
            getCustoms().remove(SECREKEY);
        }
    }

    public String getIosApiKey() {
        return getCustoms().get(IOSAPIKEY);
    }

    public void setIosApiKey(String model) {
        if (model != null) {
            getCustoms().put(IOSAPIKEY, model.toString());
        } else {
            getCustoms().remove(IOSAPIKEY);
        }
    }

    public String getIosSecretKey() {
        return getCustoms().get(IOSSECRETKEY);
    }

    public void setIosSecretKey(String model) {
        if (model != null) {
            getCustoms().put(IOSSECRETKEY, model.toString());
        } else {
            getCustoms().remove(IOSSECRETKEY);
        }
    }

    public String getStatus() {
        return getCustoms().get(STATUS);
    }

    public void setStatus(String status) {
        if (status != null) {
            getCustoms().put(STATUS, status.toString());
        } else {
            getCustoms().remove(STATUS);
        }
    }

    public void setDeviceId(String model) {
        if (model != null) {
            getCustoms().put(DEVICE_ID, model.toString());
        } else {
            getCustoms().remove(DEVICE_ID);
        }
    }

    public String getDeviceId() {
        return getCustoms().get(DEVICE_ID);
    }


    private Map<String, String> jpushConfig;


    public SiteJpush(Map<String, String> customs) {
        this.jpushConfig = customs;
    }

    public Map<String, String> getJpushConfig() {
        return jpushConfig;
    }

    public void setJpushConfig(Map<String, String> jpushConfig) {
        this.jpushConfig = jpushConfig;
    }

    public SiteJpush() {}
    public SiteJpush(Site site) {
        this.jpushConfig = site.getJpushConfig();
    }

    public void setCustoms(Map<String, String> customs) {
        this.jpushConfig = customs;
    }

    @Override
    public String getPrefix() {
        return PREFIX;
    }

    @Override
    public Map<String, String> getCustoms() {
        if (jpushConfig == null) {
            jpushConfig = new HashMap<String, String>();
        }
        return jpushConfig;
    }
}
